////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017-2018 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// THIS IS AUTO-GENERATED CODE.  PLEASE DO NOT EDIT (File bug reports against tools).
///
/// Auto-generated by: ParameterParser V1.1.4
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  camxeepromdriver.cpp
/// @brief Auto-generated Chromatix parameter file
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "camxeepromdriver.h"
#include "parametersetmanager.h"

CAMX_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EEPROMDriverDataClass::EEPROMDriverDataClass(
    const CHAR* name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, 0, 0, 0, 0)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(slaveInfo);
    PARAMETER_INITIALIZE(memoryMap);
    PARAMETER_INITIALIZE(formatInfo);
    PARAMETER_INITIALIZE(customInfoCount);
    PARAMETER_INITIALIZE(customInfoID);
    PARAMETER_INITIALIZE(customInfo);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EEPROMDriverDataClass::EEPROMDriverDataClass(
    const CHAR* name,
    UINT32 modeId,
    UINT16 mode,
    UINT16 subMode,
    UINT32 group)
    : ParameterModule(name, MAJOR, MINOR, PATCH, modeId, mode, subMode, group)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(slaveInfo);
    PARAMETER_INITIALIZE(memoryMap);
    PARAMETER_INITIALIZE(formatInfo);
    PARAMETER_INITIALIZE(customInfo);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EEPROMDriverDataClass::~EEPROMDriverDataClass()
{
    UnloadEEPROMDriverData(this);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetName
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CHAR* EEPROMDriverDataClass::GetName(
    const CHAR* type)
{
    const CHAR* name = type;
    CHAR temp[ParameterFileSymbolTableEntry::TYPE_LEN + 1];
    if (PARAMETER_STRCMP(type, ParameterFileSymbolTableEntry::GetType(temp, "EEPROMDriverData")) == 0)
    {
        name = "EEPROMDriverData";
    }
    return name;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load EEPROMSlaveInformation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadEEPROMSlaveInformation(
    ParameterFileSymbolTableEntry* entry,
    EEPROMSlaveInformation* structure)
{
    BOOL result = TRUE;

    // Reading structure->EEPROMName from the symbol table
    {
        UINT32 EEPROMNameCount = 0;
        result = result && entry->ReadUInt32(&EEPROMNameCount);
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        structure->EEPROMName = NULL;
        if (result)
        {
            pointerEntry1->ReadString(&structure->EEPROMName, EEPROMNameCount);
        }
    }
    result = result && entry->ReadUInt16(&structure->slaveAddress);
    result = result && entry->ReadUInt32(&structure->regAddrType);
    result = result && entry->ReadUInt32(&structure->regDataType);
    structure->i2cFrequencyMode = (I2CFrequencyMode)entry->ReadEnum(&result);
    result = result && camxsensorcommonClass::LoadPowerSequenceInfo(entry, &structure->powerUpSequence);
    result = result && camxsensorcommonClass::LoadPowerSequenceInfo(entry, &structure->powerDownSequence);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load MemoryType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadMemoryType(
    ParameterFileSymbolTableEntry* entry,
    MemoryType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->isAvailable);
    structure->endianness = (EndianType)entry->ReadEnum(&result);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load MemoryInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadMemoryInfo(
    ParameterFileSymbolTableEntry* entry,
    MemoryInfo* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt16(&structure->offset);
    result = result && entry->ReadUInt32(&structure->mask);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load AFInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadAFInfo(
    ParameterFileSymbolTableEntry* entry,
    AFInfo* structure)
{
    BOOL result = TRUE;
    result = result && LoadMemoryType(entry, &structure->autoFocusData);
    result = result && LoadMemoryInfo(entry, &structure->macro);
    result = result && LoadMemoryInfo(entry, &structure->infinity);
    result = result && LoadMemoryInfo(entry, &structure->hall);
    result = result && LoadMemoryInfo(entry, &structure->hallBias);
    result = result && entry->ReadUInt32(&structure->hallRegisterAddr);
    result = result && LoadMemoryInfo(entry, &structure->verticalMacro);
    result = result && LoadMemoryInfo(entry, &structure->verticalInfinity);
    result = result && LoadMemoryInfo(entry, &structure->horizontalMacro);
    result = result && LoadMemoryInfo(entry, &structure->horizontalInfinity);
    result = result && entry->ReadFloat(&structure->macroMargin);
    result = result && entry->ReadFloat(&structure->infinityMargin);
    structure->lensSagCalMac = (AfLensSagType)entry->ReadEnum(&result);
    structure->lensSagCalInf = (AfLensSagType)entry->ReadEnum(&result);
    result = result && LoadMemoryInfo(entry, &structure->otpGravityOfs0to90);
    result = result && LoadMemoryInfo(entry, &structure->otpGravityOfs90to180);
    result = result && entry->ReadInt16(&structure->avgGravityOfs0to90);
    result = result && entry->ReadInt16(&structure->avgGravityOfs90to180);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load WBlightInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadWBlightInfo(
    ParameterFileSymbolTableEntry* entry,
    WBlightInfo* structure)
{
    BOOL result = TRUE;
    structure->illuminantType = (EEPROMIlluminantType)entry->ReadEnum(&result);
    result = result && LoadMemoryInfo(entry, &structure->rValue);
    result = result && LoadMemoryInfo(entry, &structure->grValue);
    result = result && LoadMemoryInfo(entry, &structure->bValue);
    result = result && LoadMemoryInfo(entry, &structure->gbValue);
    result = result && LoadMemoryInfo(entry, &structure->rOverGValue);
    result = result && LoadMemoryInfo(entry, &structure->bOverGValue);
    result = result && LoadMemoryInfo(entry, &structure->grOverGBValue);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load WBInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadWBInfo(
    ParameterFileSymbolTableEntry* entry,
    WBInfo* structure)
{
    BOOL result = TRUE;
    result = result && LoadMemoryType(entry, &structure->WBData);
    structure->datatype = (WBType)entry->ReadEnum(&result);

    // Reading structure->lightInfo from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->lightInfoCount);
        structure->lightInfoID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->lightInfo   = PARAMETER_NEW WBlightInfo[structure->lightInfoCount];
        }
        if (!result || structure->lightInfo == NULL)
        {
            structure->lightInfoCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->lightInfoCount; i++)
        {
            result = result && LoadWBlightInfo(pointerEntry1, &structure->lightInfo[i]);
        }
    }
    result = result && LoadMemoryInfo(entry, &structure->mirror);
    result = result && LoadMemoryInfo(entry, &structure->flip);
    result = result && entry->ReadFloat(&structure->qValue);
    result = result && entry->ReadBoolean(&structure->isInvertGROverGB);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load LSClightInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadLSClightInfo(
    ParameterFileSymbolTableEntry* entry,
    LSClightInfo* structure)
{
    BOOL result = TRUE;
    structure->illuminantType = (EEPROMIlluminantType)entry->ReadEnum(&result);
    result = result && LoadMemoryInfo(entry, &structure->rGainMSB);
    result = result && LoadMemoryInfo(entry, &structure->rGainLSB);
    result = result && LoadMemoryInfo(entry, &structure->grGainMSB);
    result = result && LoadMemoryInfo(entry, &structure->grGainLSB);
    result = result && LoadMemoryInfo(entry, &structure->gbGainMSB);
    result = result && LoadMemoryInfo(entry, &structure->gbGainLSB);
    result = result && LoadMemoryInfo(entry, &structure->bGainMSB);
    result = result && LoadMemoryInfo(entry, &structure->bGainLSB);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load LSCInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadLSCInfo(
    ParameterFileSymbolTableEntry* entry,
    LSCInfo* structure)
{
    BOOL result = TRUE;
    result = result && LoadMemoryType(entry, &structure->LSCData);

    // Reading structure->lightInfo from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->lightInfoCount);
        structure->lightInfoID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->lightInfo   = PARAMETER_NEW LSClightInfo[structure->lightInfoCount];
        }
        if (!result || structure->lightInfo == NULL)
        {
            structure->lightInfoCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->lightInfoCount; i++)
        {
            result = result && LoadLSClightInfo(pointerEntry1, &structure->lightInfo[i]);
        }
    }
    result = result && entry->ReadUInt16(&structure->meshHWRollOffSize);
    result = result && entry->ReadUInt16(&structure->rIncrement);
    result = result && entry->ReadUInt16(&structure->grIncrement);
    result = result && entry->ReadUInt16(&structure->gbIncrement);
    result = result && entry->ReadUInt16(&structure->bIncrement);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load DualCameraLensInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadDualCameraLensInfo(
    ParameterFileSymbolTableEntry* entry,
    DualCameraLensInfo* structure)
{
    BOOL result = TRUE;
    result = result && LoadMemoryInfo(entry, &structure->focalLength);
    result = result && LoadMemoryInfo(entry, &structure->focalLengthRatio);
    result = result && LoadMemoryInfo(entry, &structure->nativeSensorResolutionWidth);
    result = result && LoadMemoryInfo(entry, &structure->nativeSensorResolutionHeight);
    result = result && LoadMemoryInfo(entry, &structure->calibrationResolutionWidth);
    result = result && LoadMemoryInfo(entry, &structure->calibrationResolutionHeight);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load DualCameraSystemInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadDualCameraSystemInfo(
    ParameterFileSymbolTableEntry* entry,
    DualCameraSystemInfo* structure)
{
    BOOL result = TRUE;
    result = result && LoadMemoryInfo(entry, &structure->calibrationFormatVersion);
    result = result && entry->ReadUInt32(&structure->rotationMatrixSize);
    result = result && LoadMemoryInfo(entry, &structure->relativeRotationMatrixOffset);
    result = result && entry->ReadUInt32(&structure->geometricMatrixSize);
    result = result && LoadMemoryInfo(entry, &structure->relativeGeometricSurfaceParametersOffset);
    result = result && LoadMemoryInfo(entry, &structure->relativePrinciplePointX);
    result = result && LoadMemoryInfo(entry, &structure->relativePrinciplePointY);
    result = result && LoadMemoryInfo(entry, &structure->relativePositionFlag);
    result = result && LoadMemoryInfo(entry, &structure->relativeBaselineDistance);
    result = result && LoadMemoryInfo(entry, &structure->masterSensorMirrorFlipSetting);
    result = result && LoadMemoryInfo(entry, &structure->auxSensorMirrorFlipSetting);
    result = result && LoadMemoryInfo(entry, &structure->moduleOrientationFlag);
    result = result && LoadMemoryInfo(entry, &structure->rotationFlag);

    // Reading structure->brightnessRatio from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->brightnessRatioExists);
        structure->brightnessRatioID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result && structure->brightnessRatioExists)
        {
            result = result && LoadMemoryInfo(pointerEntry1, &structure->brightnessRatio);
        }
        else
        {
            PARAMETER_INITIALIZE(structure->brightnessRatio);
        }
    }

    // Reading structure->referenceSlaveGain from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->referenceSlaveGainExists);
        structure->referenceSlaveGainID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result && structure->referenceSlaveGainExists)
        {
            result = result && LoadMemoryInfo(pointerEntry1, &structure->referenceSlaveGain);
        }
        else
        {
            PARAMETER_INITIALIZE(structure->referenceSlaveGain);
        }
    }

    // Reading structure->referenceSlaveExpTime from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->referenceSlaveExpTimeExists);
        structure->referenceSlaveExpTimeID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result && structure->referenceSlaveExpTimeExists)
        {
            result = result && LoadMemoryInfo(pointerEntry1, &structure->referenceSlaveExpTime);
        }
        else
        {
            PARAMETER_INITIALIZE(structure->referenceSlaveExpTime);
        }
    }

    // Reading structure->referenceMasterGain from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->referenceMasterGainExists);
        structure->referenceMasterGainID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result && structure->referenceMasterGainExists)
        {
            result = result && LoadMemoryInfo(pointerEntry1, &structure->referenceMasterGain);
        }
        else
        {
            PARAMETER_INITIALIZE(structure->referenceMasterGain);
        }
    }

    // Reading structure->referenceMasterExpTime from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->referenceMasterExpTimeExists);
        structure->referenceMasterExpTimeID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result && structure->referenceMasterExpTimeExists)
        {
            result = result && LoadMemoryInfo(pointerEntry1, &structure->referenceMasterExpTime);
        }
        else
        {
            PARAMETER_INITIALIZE(structure->referenceMasterExpTime);
        }
    }

    // Reading structure->referenceMasterColorTemp from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->referenceMasterColorTempExists);
        structure->referenceMasterColorTempID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result && structure->referenceMasterColorTempExists)
        {
            result = result && LoadMemoryInfo(pointerEntry1, &structure->referenceMasterColorTemp);
        }
        else
        {
            PARAMETER_INITIALIZE(structure->referenceMasterColorTemp);
        }
    }

    // Reading structure->qValue from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->qValueExists);
        structure->qValueID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result && structure->qValueExists)
        {
            result = result && pointerEntry1->ReadFloat(&structure->qValue);
        }
        else
        {
            PARAMETER_INITIALIZE(structure->qValue);
        }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load DualCameraInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadDualCameraInfo(
    ParameterFileSymbolTableEntry* entry,
    DualCameraInfo* structure)
{
    BOOL result = TRUE;
    result = result && LoadMemoryType(entry, &structure->DualCameraData);
    result = result && entry->ReadUInt16(&structure->offset);
    result = result && entry->ReadUInt32(&structure->settingsize);
    result = result && LoadDualCameraLensInfo(entry, &structure->masterInfo);
    result = result && LoadDualCameraLensInfo(entry, &structure->auxInfo);
    result = result && LoadDualCameraSystemInfo(entry, &structure->systemInfo);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load SPCInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadSPCInfo(
    ParameterFileSymbolTableEntry* entry,
    SPCInfo* structure)
{
    BOOL result = TRUE;
    result = result && LoadMemoryType(entry, &structure->SPCData);
    result = result && LoadMemoryInfo(entry, &structure->dataOffset);
    result = result && entry->ReadUInt16(&structure->SPCAddress);
    result = result && entry->ReadUInt32(&structure->settingsSize);
    result = result && entry->ReadUInt32(&structure->addressType);
    result = result && entry->ReadUInt32(&structure->dataType);
    result = result && entry->ReadUInt16(&structure->delay);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load OISInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadOISInfo(
    ParameterFileSymbolTableEntry* entry,
    OISInfo* structure)
{
    BOOL result = TRUE;
    result = result && LoadMemoryType(entry, &structure->OISData);
    result = result && LoadMemoryInfo(entry, &structure->dataOffset);

    // Reading structure->OISAddressArray from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->OISAddressArrayCount);
        structure->OISAddressArrayID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->OISAddressArray   = PARAMETER_NEW UINT32[structure->OISAddressArrayCount];
        }
        if (!result || structure->OISAddressArray == NULL)
        {
            structure->OISAddressArrayCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->OISAddressArrayCount; i++)
        {
            result = result && pointerEntry1->ReadUInt32(&structure->OISAddressArray[i]);
        }
    }
    result = result && entry->ReadUInt32(&structure->settingsSize);
    result = result && entry->ReadUInt32(&structure->addressType);
    result = result && entry->ReadUInt32(&structure->dataType);
    result = result && entry->ReadUInt16(&structure->delay);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load PDAFDCCInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadPDAFDCCInfo(
    ParameterFileSymbolTableEntry* entry,
    PDAFDCCInfo* structure)
{
    BOOL result = TRUE;
    result = result && LoadMemoryType(entry, &structure->DCCData);
    result = result && LoadMemoryInfo(entry, &structure->slopeDataOffset);
    result = result && LoadMemoryInfo(entry, &structure->offsetDataOffset);
    result = result && entry->ReadUInt16(&structure->knotX);
    result = result && entry->ReadUInt16(&structure->knotY);
    result = result && entry->ReadUInt16(&structure->offsetX);
    result = result && entry->ReadUInt16(&structure->offsetY);
    result = result && entry->ReadUInt16(&structure->areaX);
    result = result && entry->ReadUInt16(&structure->areaY);
    result = result && entry->ReadUInt16(&structure->qValue);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load PDAF2DInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadPDAF2DInfo(
    ParameterFileSymbolTableEntry* entry,
    PDAF2DInfo* structure)
{
    BOOL result = TRUE;
    result = result && LoadMemoryType(entry, &structure->PDAF2DData);
    result = result && LoadMemoryInfo(entry, &structure->version);
    result = result && LoadMemoryInfo(entry, &structure->mapWidth);
    result = result && LoadMemoryInfo(entry, &structure->mapHeight);
    result = result && entry->ReadUInt16(&structure->gainWidth);
    result = result && entry->ReadUInt16(&structure->gainHeight);
    result = result && LoadMemoryInfo(entry, &structure->leftGainMap);
    result = result && LoadMemoryInfo(entry, &structure->rightGainMap);
    result = result && entry->ReadUInt16(&structure->conversionCoefficientCount);
    result = result && LoadMemoryInfo(entry, &structure->conversionCoefficient);
    result = result && entry->ReadUInt16(&structure->DCCQFormat);
    result = result && entry->ReadUInt16(&structure->DCCMapWidth);
    result = result && entry->ReadUInt16(&structure->DCCMapHeight);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load EEPROMDataFormatInformation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadEEPROMDataFormatInformation(
    ParameterFileSymbolTableEntry* entry,
    EEPROMDataFormatInformation* structure)
{
    BOOL result = TRUE;
    result = result && LoadAFInfo(entry, &structure->AF);
    result = result && LoadWBInfo(entry, &structure->WB);
    result = result && LoadLSCInfo(entry, &structure->LSC);
    result = result && LoadDualCameraInfo(entry, &structure->dualCamera);
    result = result && LoadSPCInfo(entry, &structure->SPC);
    result = result && LoadOISInfo(entry, &structure->OIS);
    result = result && LoadPDAFDCCInfo(entry, &structure->PDAFDCC);
    result = result && LoadPDAF2DInfo(entry, &structure->PDAF2D);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load CustomInformation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadCustomInformation(
    ParameterFileSymbolTableEntry* entry,
    CustomInformation* structure)
{
    BOOL result = TRUE;

    // Reading structure->name from the symbol table
    {
        UINT32 nameCount = 0;
        result = result && entry->ReadUInt32(&nameCount);
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        structure->name = NULL;
        if (result)
        {
            pointerEntry1->ReadString(&structure->name, nameCount);
        }
    }
    result = result && entry->ReadInt32(&structure->value);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load EEPROMDriverData
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::LoadEEPROMDriverData(
    ParameterFileSymbolTableEntry* entry,
    EEPROMDriverData* structure)
{
    BOOL result = TRUE;
    result = result && Loadmodule_versionStruct(entry, &structure->module_version);
    result = result && LoadEEPROMSlaveInformation(entry, &structure->slaveInfo);
    result = result && camxsensorcommonClass::LoadSettingsInfo(entry, &structure->memoryMap);
    result = result && LoadEEPROMDataFormatInformation(entry, &structure->formatInfo);

    // Reading structure->customInfo from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->customInfoCount);
        structure->customInfoID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->customInfo   = PARAMETER_NEW CustomInformation[structure->customInfoCount];
        }
        if (!result || structure->customInfo == NULL)
        {
            structure->customInfoCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->customInfoCount; i++)
        {
            result = result && LoadCustomInformation(pointerEntry1, &structure->customInfo[i]);
        }
    }

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL EEPROMDriverDataClass::Loadmodule_versionStruct(
    ParameterFileSymbolTableEntry* entry,
    EEPROMDriverData::module_versionStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->major_revision);
    result = result && entry->ReadInt32(&structure->minor_revision);
    result = result && entry->ReadInt32(&structure->incr_revision);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload EEPROMSlaveInformation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void EEPROMDriverDataClass::UnloadEEPROMSlaveInformation(
    EEPROMSlaveInformation* structure)
{
    PARAMETER_DELETE[] structure->EEPROMName;
    camxsensorcommonClass::UnloadPowerSequenceInfo(&structure->powerUpSequence);
    camxsensorcommonClass::UnloadPowerSequenceInfo(&structure->powerDownSequence);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload WBInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void EEPROMDriverDataClass::UnloadWBInfo(
    WBInfo* structure)
{
    PARAMETER_DELETE[] structure->lightInfo;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload LSCInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void EEPROMDriverDataClass::UnloadLSCInfo(
    LSCInfo* structure)
{
    PARAMETER_DELETE[] structure->lightInfo;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload OISInfo
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void EEPROMDriverDataClass::UnloadOISInfo(
    OISInfo* structure)
{
    PARAMETER_DELETE[] structure->OISAddressArray;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload EEPROMDataFormatInformation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void EEPROMDriverDataClass::UnloadEEPROMDataFormatInformation(
    EEPROMDataFormatInformation* structure)
{
    UnloadWBInfo(&structure->WB);
    UnloadLSCInfo(&structure->LSC);
    UnloadOISInfo(&structure->OIS);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload CustomInformation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void EEPROMDriverDataClass::UnloadCustomInformation(
    CustomInformation* structure)
{
    PARAMETER_DELETE[] structure->name;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload EEPROMDriverData
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void EEPROMDriverDataClass::UnloadEEPROMDriverData(
    EEPROMDriverData* structure)
{
    UnloadEEPROMSlaveInformation(&structure->slaveInfo);
    camxsensorcommonClass::UnloadSettingsInfo(&structure->memoryMap);
    UnloadEEPROMDataFormatInformation(&structure->formatInfo);
    for (UINT32 i = 0; i < structure->customInfoCount; i++)
    {
        UnloadCustomInformation(&structure->customInfo[i]);
    }
    PARAMETER_DELETE[] structure->customInfo;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Parse symbol table entry, and return a new object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParameterModule* EEPROMDriverDataClass::Parse(
    ParameterSetManager* manager,
    ParameterFileSymbolTableEntry* entry) const
{
    EEPROMDriverDataClass* cls = NULL;

    if (PARAMETER_STRCMP(Type, entry->Type) == 0 && Major == entry->Major &&
        Minor == entry->Minor && Patch == entry->Patch)
    {
        cls = PARAMETER_NEW EEPROMDriverDataClass(GetName(entry->Type), 
            entry->ModeId, entry->Mode, entry->SubMode, entry->Group);
        if (cls != NULL)
        {
            BOOL result = TRUE;

            cls->SymbolTableID = entry->ID;
            cls->ID            = entry->ID;

            result = result && LoadEEPROMDriverData(entry, cls);

            if (!result)
            {
                PARAMETER_DELETE cls;
                cls = NULL;
            }
        }
    }
    return (ParameterModule*)cls;
}


CAMX_NAMESPACE_END
